<?php
namespace application\admin\panels;

class newsletter extends panel {
	public $name = 'Newsletter Subscriptions';
	public static function js() {
		?>
		<script type="text/javascript">
			$(document).ready(function() {
				$('#newsletter-select-all').click(function() {
					$('#subscriptions').select();
				});
			});
		</script>
		<?php
	}
	public function display() {
		$subscriptions = DB()->getVarArray("SELECT `sub_email` FROM `newsletter_subscriptions`");
		?>
		<div class="one-column">
			<div class="box">
				<h3>Newsletter Subscriptions (CSV)</h3>
				<div class="box-content">
					
					<textarea id="subscriptions" width="100%"><?=implode(',', $subscriptions);?></textarea>
					<button id="newsletter-select-all">Select All</button>
					
				</div>
			</div>
		</div>
	
		<?php
	}
}

?>